package org.thss.petri.gef.editparts.policies;

import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.FlowLayoutEditPolicy;
import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
import org.eclipse.gef.requests.CreateRequest;
import org.thss.petri.gef.commands.CreateTokenCommand;
import org.thss.petri.model.Token;

public class TokenLayoutEditPolicy extends FlowLayoutEditPolicy {

	@Override
	protected Command getCreateCommand(CreateRequest request) {
		Object newObject = request.getNewObject();
		if (!(newObject instanceof Token)) {
			return null;
		}
		Token token = (Token) newObject;
		CreateTokenCommand command = new CreateTokenCommand();
		command.setToken(token);
		command.setContainer((EObject) getHost().getModel());
		return command;
	}

	@Override
	protected Command createAddCommand(EditPart child, EditPart after) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected Command createMoveChildCommand(EditPart child, EditPart after) {
		// TODO Auto-generated method stub
		return null;
	}
}
